﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Util.Bit
{
    public class BitUtility
    {
        public static void ByteToBit(byte b, byte[] buffer)
        {
            for (int i = 0; i < 8; i++)
            {
                buffer[i] = (byte)((b >> i) & 1);
            }
        }

        public static byte[] ByteToBit(byte b)
        {
            byte[] bits = new byte[8];
            ByteToBit(b, bits);
            return bits;
        }
    }
}
